﻿#include <stdio.h>
#include<stdlib.h>
#include <sys/types.h>
#include <unistd.h>
 #include <signal.h>

#include "debug/debug.h"
#include "media.h"


static void signal_handler(int signum)
{
	print_debug("pid(%d) crashed by signal(%d).", getpid(), signum);
	
	media_cmd_eventloop_quit();
	media_stop();

	exit(-1);
}

void init_signal()
{
	struct sigaction sigAction;

	sigAction.sa_handler = signal_handler;

	sigemptyset(&sigAction.sa_mask);
	sigAction.sa_flags = 0;
	sigaction(SIGINT, &sigAction, NULL);
	sigaction(SIGPIPE, &sigAction, NULL);
}

int main()
{
	print_debug("build info:%s %s",__DATE__, __TIME__);

	/* 信号初始化 */
	// init_signal();
	
	media_start();

	media_cmd_eventloop(0);

	media_stop();

	return 0;
}
